package com.sunday.boot3.user.center.controller.impl;

import com.sunday.common.core.remoting.base.page.PageResultDTO;
import com.sunday.common.core.remoting.base.response.Response;
import com.sunday.boot3.user.center.controller.UserRoleController;
import com.sunday.boot3.user.center.pojo.dto.user.role.RemoveUserRoleReqDTO;
import com.sunday.boot3.user.center.pojo.dto.user.role.SaveUserRoleReqDTO;
import com.sunday.boot3.user.center.pojo.dto.user.role.PageUserRoleResDTO;
import com.sunday.boot3.user.center.pojo.dto.user.role.UpdateUserRoleReqDTO;
import com.sunday.boot3.user.center.pojo.dto.user.role.PageUserRoleReqDTO;
import com.sunday.boot3.user.center.service.UserRoleService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;

/**
 * @Description: 用户角色关系表 Controller 层
 * @author: zsy
 * @Create: 2024/09/22 16:24:39
 */
@Slf4j
@Controller
@RequiredArgsConstructor
public class UserRoleControllerImpl implements UserRoleController {

    private final UserRoleService userRoleService;

    /**
     * @Description: 新增 用户角色关系表 数据
     * @Param: [saveUserRoleReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response save(SaveUserRoleReqDTO saveUserRoleReqDTO) {
        userRoleService.save(saveUserRoleReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 删除 用户角色关系表 数据
     * @Param: [removeUserRoleReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response remove(RemoveUserRoleReqDTO removeUserRoleReqDTO) {
        userRoleService.remove(removeUserRoleReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 修改 用户角色关系表 数据
     * @Param: [updateUserRoleReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response update(UpdateUserRoleReqDTO updateUserRoleReqDTO) {
        userRoleService.update(updateUserRoleReqDTO);
        return Response.ok();
    }

    /**
     * @Description: 获取 用户角色关系表 分页列表数据
     * @Param: [pageUserRoleReqDTO]
     * @Return: com.sunday.common.core.remoting.base.response.Response<com.sunday.common.core.remoting.base.page.PageResultDTO<com.sunday.boot3.user.center.pojo.dto.user.role.PageUserRoleResDTO>>
     * @Author: zsy
     * @Time: 2024/09/22 16:24:39
     */
    @Override
    public Response<PageResultDTO<PageUserRoleResDTO>> page(PageUserRoleReqDTO pageUserRoleReqDTO) {
        return Response.ok(userRoleService.page(pageUserRoleReqDTO));
    }

}
